package org.example.partten.factory.post;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.example.dao.dao.post.PImageDao;
import org.example.dao.entity.post.PImage;
import org.example.partten.factory.ImageListFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 22449
 */
@Component
public class PostImageListFactory implements ImageListFactory {

    @Resource
    private PImageDao pImageDao;

    @Override
    public List createImageList(String linkId) {
        LambdaQueryWrapper<PImage> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
        lambdaQueryWrapper1.eq(PImage::getPostId, linkId);
        lambdaQueryWrapper1.eq(PImage::getIsValid, 1);
        List<PImage> imageList = pImageDao.selectList(lambdaQueryWrapper1);
        return imageList;
    }

}
